package com.ktgj.customer.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.ktgj.customer.domain.Employee;
import com.ktgj.customer.mapper.EmployeeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktgj.customer.mapper.EmployeeVipresourceMapper;
import com.ktgj.customer.domain.EmployeeVipresource;
import com.ktgj.customer.service.IEmployeeVipresourceService;

/**
 * 【请填写功能名称】Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-09-20
 */
@Service
public class EmployeeVipresourceServiceImpl implements IEmployeeVipresourceService 
{
    @Autowired
    private EmployeeVipresourceMapper employeeVipresourceMapper;

    @Autowired
    private EmployeeMapper employeeMapper;

    /**
     * 查询【请填写功能名称】
     * 
     * @param vipresourceId 【请填写功能名称】ID
     * @return 【请填写功能名称】
     */
    @Override
    public EmployeeVipresource selectEmployeeVipresourceById(Long vipresourceId)
    {
        return employeeVipresourceMapper.selectEmployeeVipresourceById(vipresourceId);
    }

    /**
     * 查询【请填写功能名称】列表
     * 
     * @param employeeVipresource 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<EmployeeVipresource> selectEmployeeVipresourceList(EmployeeVipresource employeeVipresource)
    {
        List<EmployeeVipresource> lstData = employeeVipresourceMapper.selectEmployeeVipresourceList(employeeVipresource);
        for (EmployeeVipresource vipresource :lstData)
        {
            Employee tmpEmployee = employeeMapper.selectEmployeeById(vipresource.getEmployeeId());
            if (tmpEmployee != null)
            {
                vipresource.setEmployeeName(tmpEmployee.getEmployeeName());
            }
        }
        return lstData;
    }

    /**
     * 新增【请填写功能名称】
     * 
     * @param employeeVipresource 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertEmployeeVipresource(EmployeeVipresource employeeVipresource)
    {
        return employeeVipresourceMapper.insertEmployeeVipresource(employeeVipresource);
    }

    /**
     * 修改【请填写功能名称】
     * 
     * @param employeeVipresource 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateEmployeeVipresource(EmployeeVipresource employeeVipresource)
    {
        return employeeVipresourceMapper.updateEmployeeVipresource(employeeVipresource);
    }

    /**
     * 批量删除【请填写功能名称】
     * 
     * @param vipresourceIds 需要删除的【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteEmployeeVipresourceByIds(Long[] vipresourceIds)
    {
        return employeeVipresourceMapper.deleteEmployeeVipresourceByIds(vipresourceIds);
    }

    /**
     * 删除【请填写功能名称】信息
     * 
     * @param vipresourceId 【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteEmployeeVipresourceById(Long vipresourceId)
    {
        return employeeVipresourceMapper.deleteEmployeeVipresourceById(vipresourceId);
    }

    @Override
    public int deleteVipResourceByEmployeeId(Long employeeId)
    {
        int rows = employeeVipresourceMapper.deleteVipResourceByEmployeeId(employeeId);
        return rows;
    }

    @Override
    public int deleteVipResourceBySingle(Long employeeId, String phone)
    {
        int rows = employeeVipresourceMapper.deleteVipResourceBySingle(employeeId,phone);
        return rows;
    }
}
